#pragma once
#include "OrthogonalCamera.h"
#include "Texture.h"
#include "SubTexture2D.h"
#include "Renderer/Camera.h"
namespace Orange {

	class Renderer2D
	{
	public:

		static void Init();
		static void StartScene(const glm::mat4& prejectMatrix,const glm::mat4& transform);
		static void StartScene(OrthogonalCamera& camera);
		static void EndScene();
		static void Shutdown();
		static void Flush();



		static void DrawQuad(const glm::vec2& position , const glm::vec2& size , const glm::vec4& color);
		static void DrawQuad(const glm::vec3& position , const glm::vec2& size , const glm::vec4& color);
		static void DrawQuad(const glm::mat4& transform , const glm::vec4& color);
		static void DrawQuad(const glm::mat4& transform , const Ref<Texture2D>& texture, const float u_TileFactory = 1.0f, const glm::vec4& tinyColor = glm::vec4(1.0));
		static void DrawQuad(const glm::vec2& position , const glm::vec2& size , const Ref<Texture2D>& texture ,const float u_TileFactory = 1.0f, const glm::vec4& tinyColor = glm::vec4(1.0));
		static void DrawQuad(const glm::vec3& position , const glm::vec2& size , const Ref<Texture2D>& texture ,const float u_TileFactory = 1.0f, const glm::vec4& tinyColor = glm::vec4(1.0));
		static void DrawQuad(const glm::vec2& position , const glm::vec2& size , const Ref<SubTexture2D>& subTexture, const float u_TileFactory = 1.0f, const glm::vec4& tinyColor = glm::vec4(1.0));
		static void DrawQuad(const glm::vec3& position , const glm::vec2& size , const Ref<SubTexture2D>& subTexture,  const float u_TileFactory = 1.0f, const glm::vec4& tinyColor = glm::vec4(1.0));
		static void DrawRotationQuad(const glm::vec2& position , const glm::vec2& size , float rotation, const glm::vec4& color);
		static void DrawRotationQuad(const glm::vec3& position , const glm::vec2& size , float rotation, const glm::vec4& color);
		static void DrawRotationQuad(const glm::vec2& position , const glm::vec2& size , float rotation, const Ref<Texture2D>& texture, const float u_TileFactory = 1.0f , const glm::vec4& tinyColor = glm::vec4(1.0));
		static void DrawRotationQuad(const glm::vec3& position , const glm::vec2& size , float rotation, const Ref<Texture2D>& texture, const float u_TileFactory = 1.0f , const glm::vec4& tinyColor = glm::vec4(1.0));
		static void DrawRotationQuad(const glm::vec2& position , const glm::vec2& size , float rotation, const Ref<SubTexture2D>& subTexture,  const float u_TileFactory = 1.0f , const glm::vec4& tinyColor = glm::vec4(1.0));
		static void DrawRotationQuad(const glm::vec3& position , const glm::vec2& size , float rotation, const Ref<SubTexture2D>& subTexture,  const float u_TileFactory = 1.0f , const glm::vec4& tinyColor = glm::vec4(1.0));

		struct stats {
			uint32_t DrawCall = 0;
			uint32_t QuadCount = 0;

			uint32_t  GetQuadVertexCount() { return QuadCount * 4; };
			uint32_t  GetQuadIndexCount() { return QuadCount * 6; };

		};

		static stats GetStat();
		static void ResetStat();
		
	private:
		static void FlushAndReset();
	
	};

}